﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EstimateLib
{
    /// <summary>
    /// 后缀等级
    /// </summary>
    public enum DomainSufixLevel
    {
        /// <summary>
        /// A级：.com 
        /// </summary>
        A,
        /// <summary>
        /// B级 
        /// </summary>        
        B,
        /// <summary>
        /// C级：.net 
        /// </summary> 
        C,
        /// <summary>
        ///D级：.org及其他顶级域名 
        /// </summary> 
        D,
        /// <summary>
        ///E级：二级域名（如.com.cn若允许转让的话） 
        /// </summary> 
        E
    }
    /// <summary>
    /// 后缀评估类
    /// </summary>
    public class DomainSufixEstimater
    {
        public DomainSufixLevel CaculateDomainSufixLevel(string sufix)
        {
            if (string.IsNullOrEmpty(sufix))
            {
                throw new Exception("域名后缀为空，无法评估等级");
            }

            switch (sufix.ToLower())
            {
                case "com": return DomainSufixLevel.A;
                case "net": return DomainSufixLevel.B;
                case "cn": return DomainSufixLevel.C;
                case "org": return DomainSufixLevel.D;
                default: return DomainSufixLevel.E;
            }
        }
    }
}
